<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE html>
<html>
<head>
	<title>登录页面</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="keywords" content="登录页面" />
	<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
	<!-- Custom Theme files -->
	<link href="__STATIC__/home/login/css/font-awesome.min.css" rel="stylesheet" type="text/css" media="all">
	<link href="__STATIC__/home/login/css/snow.css" rel="stylesheet" type="text/css" media="all" />
	<link href="__STATIC__/home/login/css/style.css" rel="stylesheet" type="text/css" media="all" />
	<link rel="stylesheet" href="__STATIC__/home/js/layer/theme/default/layer.css">
	<link rel="shortcut icon" href="__STATIC__/home/index/picture/2.png" type="image/x-icon">
</head>
<body>
<div class="snow-container">
	<div class="snow foreground"></div>
	<div class="snow foreground layered"></div>
	<div class="snow middleground"></div>
	<div class="snow middleground layered"></div>
	<div class="snow background"></div>
	<div class="snow background layered"></div>
</div>

<div class="top-buttons-agileinfo">
	<a href="#"  class="active">登录</a><a href="{:url('home/users/register')}">注册</a><a href="{:url('home/index/index')}">返回首页</a>
</div>
<h1>登录
</h1>
<div class="main-agileits">
	<!--form-stars-here-->
	<div class="form-w3-agile">
		<h2 class="sub-agileits-w3layouts">用户登录</h2>
		<!--<form action="{:url('home/users/login')}" method="post">-->
			<input type="text" class="mobile" name="mobile" placeholder="手机号码" />
			<input type="password" class="user_pwd" name="user_pwd" placeholder="密码"  />
			<a href="{:url('home/users/forget')}" class="forgot-w3layouts">忘记密码 ?</a>
			<div class="submit-w3l">
				<input class="login" type="submit" value="登录">
			</div>
			<div class="img1">
				<p>第三方登录<a href="{:url('home/weixin/getCode')}"><img src="__STATIC__/home/index/picture/weixin.jpg" width="20px" height="20px"  /></a></p>
			</div>
			<p class="p-bottom-w3ls">如果你没有一个帐户?<a href="{:url('home/users/register')}">点击注册</a>.</p>

	</div>
</div>
<!--//form-ends-here-->
<!-- copyright -->
<div class="copyright w3-agile">
	<p>  © 2017 Internship Sign In & Sign Up Form . All rights reserved | Design by chuangxuexi </p>
</div>
<!-- //copyright -->

</body>

<script src="__STATIC__/home/js/jquery.min.js"></script>
<script src="__STATIC__/home/js/layer/layer.js"></script>

<script>

	//登录
    $(document).ready(function () {
        $(".login").click(function () {

            var data = {};
            data.mobile = $(".mobile").val();
            data.user_pwd =$(".user_pwd").val();

            if(data.mobile == ""){
                layer.tips('账号不能为空', '.mobile', {
                    tips: 3
                });
                return false;
			}
            if(!/^((\d{3}-\d{8}|\d{4}-\d{7,8})|(1[3|5|7|8][0-9]{9}))$/.test(data.mobile)){

                layer.tips('请输入正确账号', '.mobile', {
                    tips: 3
                });
                return false;
            }
            if(data.user_pwd == ""){
                layer.tips('密码不能为空', '.user_pwd', {
                    tips: 3
                });
                return false;
            }

            $.post("{:url('home/users/login')}",data,function (data) {

				if(data == 0){
                    layer.msg('登录成功！！', {icon: 1});
                    setTimeout(function(){
                        window.location.href=("{:url('home/index/index')}");
                    },2000);


				}else if(data == 1){
                    layer.msg('密码或账号不正确！！', {icon: 5});

				}else {
                    layer.msg('亲，你还没注册哦。', {icon: 7});
				}
            })
        })
	})
</script>

</html>
